﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using MMessaging.Address;
using MMessaging.MessagingEx.Common;
using MMessaging.WPF;
using TUtils.Extensions;

namespace MMessaging.Test.Fahrstuhl.ViewModels
{
	public class TestViewModelBase : DependencyObject
	{
		protected MMessagingClient4WPF EngineAdapter { get; private set; }

		/// <summary>
		/// Konstruktor
		/// </summary>
		public TestViewModelBase(IMNodeDuplex<MAddressMessageBase> switchNode)
			: base()
		{
			if (!TWPFHelper.IsInDesignMode && switchNode != null)
				EngineAdapter = new MMessagingClient4WPF(
					clientLoggingName: GetType().Name,
					dispatcher: Dispatcher,
					switchNode: switchNode,
					messageHandlerOnServiceThread: null,
					messageHandlerOnWPFThread: OnMessage);
		}


		/// <summary>
		/// running on WPF thread
		/// </summary>
		/// <param name="message"></param>
		protected virtual void OnMessage(MAddressMessageBase message)
		{
		}

	}
}
